package com.tools.cleanmaster.controller;

import android.content.Context;

import com.tools.cleanmaster.model.TrashType;

/**
 * Created by lianzhan on 16/2/22.
 */
public abstract class FileMediaStoreScanner extends TrashScanner {
    public static final String DB_NAME_EXTERNAL = "external";
    /**
     * 所有sd卡对应的根目录的
     **/
    protected final String[] mSdCardRootDirs;

    protected long mScanSize = 0;

    public FileMediaStoreScanner(Context context, TrashHandler handler) {
        super(context, handler);
        this.mSdCardRootDirs = handler.getRootDirs();
        if (mSdCardRootDirs == null || mSdCardRootDirs.length == 0) {
            throw new IllegalArgumentException("没SD卡，不扫了");
        }
    }

    @Override
    public void scan(int increaseProgress) {
        doScan(increaseProgress);
        mTrashHandler.onTrashTypeFinish(getTrashType(), mScanSize);
    }

    protected abstract void doScan(int increaseProgress);

    protected abstract TrashType getTrashType();
}
